package com.cy.store.mapper;

import com.cy.store.entity.Order;
import com.cy.store.entity.OrderItem;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;

@Repository
//订单持久层
public interface OrderMapper {

    /**
     * 插入订单数据
     *
     * @param order
     * @return
     */
    Integer insertOrder(Order order);

    /**
     * 插入订单的项
     *
     * @param orderItem
     * @return
     */
    Integer insertOrderItem(OrderItem orderItem);

    /**
     * 查询订单信息
     *
     * @param oid
     * @return
     */
    Order findByOid(@Param("oid") Integer oid);

    /**
     * 支付完成后改变支付的状态
     *
     * @param oid
     * @return
     */
    Integer updateByOid(@Param("oid") Integer oid, @Param("modifiedUser") String modifiedUser,
                        @Param("payTime") Date payTime, @Param("modifiedTime") Date modifiedTime);


}
